Sell your soul
Believeth in me an hath everlasting life
Till death do us part
Axels New Music releases
Sharp Stuff
Switchblades Icepicks and german knives
Viking gear
Gear Gifts and Apparel

here are some of the best and useful php scripts and snippets to help in your projects. Php displayed below. Use the search for specific script lookups. Click the category links to view scripts in Javascript and cgi. To add your own script click the link and add your useful script example.

Text file hit counter using both fopen and wriye as well as
file get and put contents example couter scripts



<?php
 $counter 
file_get_contents("counter.txt"); $counter++; file_put_contents("counter.txt"$counter|LOCK_EX); echo $counter;
?>

Or a graphic hit counter:
<?php
 $counter 
file_get_contents("counter.txt"); $counter++; file_put_contents("counter.txt"$counter); for($i 0$i strlen($counter); $i++) echo "<img src=\"counter/".substr($counter$i1).".gif\" alt=\"".substr($counter$i1)."\" />";
?> 


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

<?php
    
// your content here...
    
$filename '/path/to/counter.txt'// our counter file
    
$fp fopen$filename,"r"); // open it for READING ("r")
    
$counter fread($fpfilesize($filename) ); // read in value
    
fclose$fp ); // close it whilst we work

    
++$counter// increase the counter by one
    
print "$counter hits to this page"// print out the new value

    
$fp fopen$filename,"w"); // open it for WRITING ("w")
    
fwrite$fp$counter); // write in the new value
    
fclose$fp ); // close it
?> 


Add your comment.













No comments yet

Search ScriptsnTips


Php JavaScripts CGI/Perl